from rest_framework import serializers
from .models import *
from webapp.serializer import GroupSerializer

class AppCatagorySerializer(serializers.ModelSerializer):
    class Meta:
        model = AppCatagory
        fields = "__all__"

class AppConfigSerializer(serializers.ModelSerializer):
    class Meta:
        model = AppConfig
        fields = "__all__"

class AppsSerializer(serializers.ModelSerializer):
    scripts = serializers.FileField(max_length=None, allow_empty_file=False,required=False)
    appcatagory = AppCatagorySerializer
    # group = GroupSerializer(many=True, required=False, read_only=True)
    group_list = serializers.PrimaryKeyRelatedField(required=False,many=True, read_only=False, queryset=Group.objects.all(),source="group")
    class Meta:
        model = App
        fields = ["id","name","describe","index","appcatagory","group_list","scripts"]




